// Copyright 2022 Tencent
#pragma once
#include "util/mutex.h"
#include "util/noncopyable.h"

#include <pthread.h>
namespace net_tools::util
{
  class Condition : noncopyable
  {
  public:
    explicit Condition(Mutex &mutex);
    ~Condition();
    void Wait();
    void Signal_one();
    void Signal_all();

  private:
    Condition() = delete;
    pthread_cond_t cond_;
    Mutex &mutex_;
  };

} // namespace net_tools::util